import { useIntl } from '@umijs/max';
import { Radio } from 'antd';
import React from 'react';

type IProps = {
  changeButtons: (data: string) => void;
};
const SwitchButtons: React.FC<IProps> = (props) => {
  const intl = useIntl();
  const { changeButtons } = props;
  const options = [
    {
      label: intl.formatMessage({ id: 'statistics.common.chart' }),
      value: 'chart',
    },
    {
      label: intl.formatMessage({ id: 'statistics.common.list' }),
      value: 'list',
    },
  ];
  return (
    <>
      <div>
        <Radio.Group
          options={options}
          optionType="button"
          defaultValue={'chart'}
          buttonStyle="solid"
          size={'middle'}
          onChange={(e) => {
            const { value } = e.target;
            changeButtons(value);
          }}
        ></Radio.Group>
      </div>
    </>
  );
};
export default SwitchButtons;
